package com.objcat.servicegateway.filter;

import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.core.Ordered;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * ClassName: InnerFilter
 *
 * Description:因想引入security而注释于7/27下午
 * <p>
 * date: 2020/7/27 9:47
 *
 * @author misheep
 * @since JDK 1.8
 */
//public class InnerFilter implements GatewayFilter, Ordered {
//
//    private AuthGatewayFilterFactory.AuthConfig config;
//
//    InnerFilter(AuthGatewayFilterFactory.AuthConfig config) {
//        this.config = config;
//    }
//
//    @Override
//    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//        System.out.println("  pre 自定义过滤器工厂 AAAA  " + this.getClass().getSimpleName());
//        boolean root = "root".equals(config.getName());
//        if (root) {
//            System.out.println("  is root ");
//        } else {
//            System.out.println("  is no root ");
//        }
//        // 在then方法里的，相当于aop中的后置通知
//        return chain.filter(exchange).then(Mono.fromRunnable(() -> {
//            System.out.println("  post 自定义过滤器工厂 AAAA " + this.getClass().getSimpleName());
//        }));
//    }
//
//    @Override
//    public int getOrder() {
//        return -100;
//    }
//}